package com.chen.testdozer;

import junit.framework.TestCase;

import org.dozer.Mapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/spring-dozer.xml"})
@TransactionConfiguration(defaultRollback = false)
public class DozerTest extends TestCase{
	@Autowired
	Mapper mapper;
	
	@Test
	public void test1(){
		SourceBean source = new SourceBean();
		source.setId(1);
		source.setData("100");
		source.setName("name1");
		
		TargetBean destination = mapper.map(source, TargetBean.class);
		System.out.println(destination.getData() + "," + destination.getTargetName());
	}
}
